//package xcmg.device.web.report;
//
//import com.google.common.base.Strings;
//import io.swagger.annotations.ApiOperation;
//import org.apache.commons.collections.CollectionUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import xcmg.device.infra.BasicController;
//import xcmg.device.service.report.ReportService;
//import xcmg.device.service.vo.report.*;
//import yb.ecp.fast.dto.UserCacheDTO;
//import yb.ecp.fast.feign.AuthClient;
//import yb.ecp.fast.infra.annotation.FastMappingInfo;
//import yb.ecp.fast.infra.infra.ActionResult;
//
//import java.util.List;
//
//@RestController
//@RequestMapping("/report/export")
//public class ReportExportController extends BasicController {
//
//    @Autowired
//    private ReportService reportService;
//    @Autowired
//    private AuthClient authClient;
//
//    @PostMapping(value = "/exportCustomerOrderStatements")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("客户订单提报统计导出")
//    public void exportCustomerOrderStatements(CustomerOrderStatementQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        reportService.exportCustomerOrderStatements(queryVO);
//    }
//
//    @PostMapping(value = "/exportDeliveryTrackingReports")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("发货跟踪报表，缺货统计报表导出")
//    public void exportDeliveryTrackingReports(DeliveryTrackingReportQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        reportService.exportDeliveryTrackingReports(queryVO);
//    }
//
//    @PostMapping(value = "/orderGoods/exportContentPercentTotalReports")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("订货满足率-总体满足率导出")
//    public void exportContentPercentTotalReports(DeliveryTrackingReportQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        reportService.exportContentPercentTotalReports(queryVO);
//    }
//
//    @PostMapping(value = "/orderGoods/exportContentPercentAgentReports")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("订货满足率-按代理商统计满足率导出")
//    public void exportContentPercentAgentReports(DeliveryTrackingReportQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        reportService.exportContentPercentAgentReports(queryVO);
//    }
//
//    @PostMapping(value = "/orderGoods/exportContentPercentMaterialReports")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("订货满足率-按零件统计满足率导出")
//    public void exportContentPercentMaterialReports(DeliveryTrackingReportQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        reportService.exportContentPercentMaterialReports(queryVO);
//    }
//
//    @PostMapping(value = "/exportDirectPurchaseAnalyseReports")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("直投采购分析导出")
//    public void exportDirectPurchaseAnalyseReports(DeliveryTrackingReportQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        reportService.exportDirectPurchaseAnalyseReports(queryVO);
//    }
//
//    @PostMapping(value = "/exportOverAllSalesReports")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("总体销售情况报表导出")
//    public void exportOverAllSalesReports(DeliveryTrackingReportQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        reportService.exportOverAllSalesReports(queryVO);
//    }
//
//    @PostMapping(value = "/exportDlsInventory")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("代理商库存统计报表导出")
//    public void exportDlsInventory(DlsInventoryQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        reportService.exportDlsInventory(queryVO);
//    }
//
//    @PostMapping(value = "/exportFwzInventory")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("服务站库存统计报表导出")
//    public void exportFwzInventory(FwzInventoryQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        ActionResult userAuth =  authClient.getUserDetail(getUserId());
//        UserCacheDTO userCacheDTO = (UserCacheDTO) userAuth.getValue();
//        String deptId = null;
//        if (userCacheDTO != null && !Strings.isNullOrEmpty(userCacheDTO.getDeptId())) {
//            //根据当前登录人的部门获取上级部门
//            deptId = reportService.getDeptId(userCacheDTO.getDeptId());
//        }
//        //获取驻外营销部id
//        String zwDeptId = reportService.getZwDeptId();
//        if (!Strings.isNullOrEmpty(deptId)&&!Strings.isNullOrEmpty(zwDeptId)){
//            if (deptId.equals(zwDeptId)){
//                //代表当前登录人是驻外营销部下的部门下员工，查询当前登录人的所拥有的服务中心code
//                List<String> codeList = reportService.getCodeList(userCacheDTO.getDeptId());
//                if (!CollectionUtils.isEmpty(codeList)){
//                    queryVO.setMarketingCenterCodes(codeList);
//                }
//            }
//        }
//        reportService.exportFwzInventory(queryVO);
//    }
//
//    @PostMapping(value = "/exportDlsDrp")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("代理商进销存报表导出")
//    public void exportDlsDrp(DlsDrpQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        reportService.exportDlsDrp(queryVO);
//    }
//
//    @PostMapping(value = "/exportFwzDrp")
//    @FastMappingInfo(needLogin = true)
//    @ApiOperation("服务站进销存报表导出")
//    public void exportFwzDrp(FwzDrpQueryVO queryVO)throws Exception {
//        queryVO.setOrgId(getOrgId());
//        ActionResult userAuth =  authClient.getUserDetail(getUserId());
//        UserCacheDTO userCacheDTO = (UserCacheDTO) userAuth.getValue();
//        String deptId = null;
//        if (userCacheDTO != null && !Strings.isNullOrEmpty(userCacheDTO.getDeptId())) {
//            //根据当前登录人的部门获取上级部门
//            deptId = reportService.getDeptId(userCacheDTO.getDeptId());
//        }
//        //获取驻外营销部id
//        String zwDeptId = reportService.getZwDeptId();
//        if (!Strings.isNullOrEmpty(deptId)&&!Strings.isNullOrEmpty(zwDeptId)){
//            if (deptId.equals(zwDeptId)){
//                //代表当前登录人是驻外营销部下的部门下员工，查询当前登录人的所拥有的服务中心code
//                List<String> codeList = reportService.getCodeList(userCacheDTO.getDeptId());
//                if (!CollectionUtils.isEmpty(codeList)){
//                    queryVO.setMarketingCenterCodes(codeList);
//                }
//            }
//        }
//        reportService.exportFwzDrp(queryVO);
//    }
//}
